package com.wilmer.pay.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;


/**
 * @author hans
 * 2024-3-31
 */
public  class OrderUtil {
    private static final AtomicInteger COUNTER = new AtomicInteger(0);
    public static String generateOrderNumber() {
        String dateString = new SimpleDateFormat("yyMMddHHmmss").format(new Date());
        String uniqueId = String.valueOf(System.currentTimeMillis() + COUNTER.getAndIncrement());
        return  dateString + uniqueId.substring(uniqueId.length() - 4);
    }

}